package com.adms.controller;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.adms.domain.ReformSign;
import com.adms.service.ReformSignService;

@RequestMapping("reform/sign")
@RestController
public class ReformSignController {

	@Autowired
	private ReformSignService reformSignService;
	
	@GetMapping("{signId}")
	public Object getBySignId(@PathVariable("signId") Integer signId) {
		return reformSignService.getBySignId(signId);
	}
	
	@GetMapping("getWithReform")
	public Object getBySignIdWithReform(@RequestParam("signId") Integer signId) {
		return reformSignService.getBySignIdWithReform(signId);
	}
	
	@GetMapping
	public Object list(ReformSign reformSign,String timeField,Date start,Date end,String orderByClause,
			@RequestParam(defaultValue = "1") Integer pageNum,
			@RequestParam(defaultValue = "5") Integer pageSize,
			@RequestParam(defaultValue = "5") Integer navigatePages) {
		return reformSignService.list(reformSign,timeField,start,end,orderByClause,pageNum,pageSize,navigatePages);
	}
	
	@PostMapping("audit")
	public Object audit(@RequestParam("signId") Integer signId,
			@RequestParam("reformId") Integer reformId,
			@RequestParam("auditState") Integer auditState,
			@RequestParam("auditView") String auditView) {
		return reformSignService.audit(signId,reformId,auditState,auditView);
	}
}
